# -*- encoding=utf8 -*-
from selenium.webdriver.common.by import By

from base.base import Base

import page

# change = By.XPATH, '//div[text()="账号密码"]'
#
# username = By.XPATH, '//input[@placeholder="请输入账号/手机号"]'
#
# password = By.XPATH, '//input[@placeholder="请输入密码"]'
#
# login_btn = By.XPATH, '//span[text()="登 录"]'

class PageLogin(Base):

    # 选择账号密码方式登录
    def __page_change(self):
        self.element_click(page.change)

    # 输入账号
    def __page_username(self, value):


        self.element_input(page.username,value)

    #输入密码
    def page_pwd(self,value):
        self.element_input(page.password,value)

    #点击登录
    def page_login_click(self):
        self.element_click(page.login_btn)

    def page_login(self,user,password):
        self.__page_change()
        self.__page_username(user)
        self.page_pwd(password)
        self.page_login_click()
